<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/11/7 0007
 * Time: 14:07
 */
namespace PHPMailer;
use PHPMailer\src\PHPMailer;

class Mail
{
	public static function sendMail($email,$title,$content){
		$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
		try {
			$mail->isSMTP();                                      // Set mailer to use SMTP
			$mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
			$mail->SMTPAuth = true;                               // Enable SMTP authentication
			$mail->Username = '1474811597@qq.com';                 // SMTP username
			$mail->Password = 'hhkcojxlggprhbdd';                           // SMTP password
			$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
			$mail->Port =  465;                                    // TCP port to connect to
			//Recipients
			$mail->setFrom('1474811597@qq.com', '小新');
			$mail->addAddress($email);               // Name is optional
			//Content
			$mail->isHTML(true);                                  // Set email format to HTML
			$mail->Subject = $title;
			$mail->Body    = $content;
			$mail->send();
			return true;
		} catch (Exception $e) {
			return false;
		}
	}
}